<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:th="http://www.thymeleaf.org" lang="en">

<head th:replace="fragments/headTag :: headTag">
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="" />
<meta name="author" content="" />
<title>QuDEx Repository Tools - Collections Manager</title>

<!-- Bootstrap -->
<link
	href="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.css"
	th:href="@{/webjars/bootstrap/3.0.3/css/bootstrap.css}"
	rel="stylesheet" />
<link href="../../../resources/css/navbar.css"
	th:href="@{/resources/css/navbar.css}" rel="stylesheet" />
<!-- JQuery -->
<script
	src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"
	th:src="@{/webjars/jquery/1.9.0/jquery.min.js}"></script>
<script
	src="http://netdna.bootstrapcdn.com/twitter-bootstrap/3.0.3/js/bootstrap.min.js"
	th:src="@{/webjars/bootstrap/3.0.3/js/bootstrap.min.js}"></script>

<!-- Spring JS and Ajax -->
<script type="text/javascript" th:src="@{/resources/dojo/dojo.js}"></script>
<script type="text/javascript" th:src="@{/resources/spring/Spring.js}"></script>
<script type="text/javascript"
	th:src="@{/resources/spring/Spring-Dojo.js}"></script>
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
      <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
    <![endif]-->
</head>
<body>
	<div class="container">
		<div th:include="fragments/bodyHeader :: bodyHeader" th:remove="tag">This
			is the navigation bar here</div>
		<ol class="breadcrumb">
			<li th:text="#{breadcrumbs.process.relations1}">Add QuDEx relations</li>
			<li class="active" th:text="#{breadcrumbs.process.relations2}">Collection selection</li>
			<li th:text="#{breadcrumbs.process.relations3}">Relations management</li>
		</ol>
		<div class="panel panel-default">
			<div class="panel-heading">
				<h3 th:text="#{relationView.colSelection.title}" class="panel-title">Selection
					of an existing QuDex collection</h3>
			</div>
			<div class="panel-body">
				<div th:if="${colsList.size() != 0}" class="alert alert-info"
						th:utext="#{relationView.colSelection.text}">
						<b>Note:</b> By selecting a specific collection, you will be
						redirected to a new page where new QuDEx relationships could be
						added to existing collection documents, e.g. associating a
						transcript with its related video/audio file.
				</div>
				<div th:unless="${colsList.size() != 0}" class="alert alert-warning"
						th:utext="#{relationView.colSelection.text1}">The repository
						does not contains any collections with a QuDEx Instance.
				</div>
				<form th:if="${colsList.size() != 0}" id="form-collection" th:action="${flowExecutionUrl}"
					method="post" class="form-horizontal">
					<fieldset>
						<legend th:text="#{relationView.colSelection.form.legend}">Collection
							Selection</legend>
						<div id="col-select" class="form-group"
							th:if="${colsList.size() != 0}">
							<label class="col-md-4 control-label" for="sp-upload-1"><span
								th:text="#{relationView.colSelection.form.label}"> Add
									relations to collection</span></label>
							<div class="col-md-4">
								<div class="input-group">
									<select th:field="${filesModel.collectionsIds}" class="form-control">
										<option value="">-------</option>
										<option th:with="element=${actualCollection.split(';')}"
											th:each="actualCollection : ${colsList}"
											th:value="${element[0]}"
											th:text="${element[1]}">the collection label</option>
									</select>
								</div>
							</div>
						</div>
					</fieldset>
					<input th:if="${colsList.size() != 0}" name="_eventId_selectedCollection"
						class="btn btn-primary" type="submit"
						th:value="#{relationView.colSelection.form.submit}" 
						value="Select Collection" />
					<input name="_eventId_cancelSelect"
						class="btn btn-danger" type="submit"
						data-toggle="popover"
						th:attr="data-content=#{relationView.colSelection.form.tooltip.cancel}"
						th:value="#{relationView.colSelection.form.cancel}" 
						value="Cancel" />
				</form>
				<a th:unless="${colsList.size() != 0}" class="btn btn-primary"
					th:href="@{'~' + ${flowExecutionUrl}(_eventId=cancelSelect)}"
					th:text="#{relationView.colSelection.form.cancel}" ></a>
			</div>
		</div>
		<div id="footer" th:include="fragments/footer :: footer"></div>
	</div>
		<script>
		/*http://stackoverflow.com/questions/16808205/keep-the-current-tab-active-with-twitter-bootstrap-after-a-page-reload/16813902#16813902*/
		$(document).ready(
				function() {

					/*Tooltips*/
					$('[data-toggle="tooltip"]').tooltip({
						'placement' : 'top'
					});

					$('[data-toggle="popover"]').popover({
						trigger : 'hover',
						'placement' : 'top'
					});
				});
	</script>
</body>
</html>
